#import "RNHoverLinkButton.h"
#import "NSCell+SRAdditions.h"

@implementation RNHoverLinkButton

-(void)updateTrackingAreas {
    [super updateTrackingAreas];
    for (NSTrackingArea *area in [self trackingAreas])
        [self removeTrackingArea:area];
    NSPoint mouseLocation = [self convertPoint:[[self window] convertScreenToBase:[NSEvent mouseLocation]] fromView:nil];
    [[self cell] addTrackingAreasForView:self inRect:[self bounds] withUserInfo:nil mouseLocation:mouseLocation];
}

-(void)mouseEntered:(NSEvent *)event {
    [[self cell] mouseEntered:event];
}

-(void)mouseExited:(NSEvent *)event {
    [[self cell] mouseExited:event];
}

-(void)setTitle:(NSString *)title {
    [super setTitle:title];
    [self sizeToFit];
}

-(void)setAttributedTitle:(NSAttributedString *)title {
    [super setAttributedTitle:title];
    [self sizeToFit];
}

@end
